package com.maslyk.invitation;

import com.maslyk.invitation.entitybean.Comment;
import com.maslyk.invitation.entitybean.Invitation;
import com.maslyk.invitation.entitybean.Order;
import com.maslyk.invitation.entitybean.Text;
import com.maslyk.invitation.enums.ViewIdentityEnum;
import com.maslyk.invitation.to.CurrentUserTO;
import com.maslyk.invitation.to.SessionDataTO;

public class NavigationUtil
{
	public NavigationUtil()
	{
	}
	
    public String goToSalesmanForm()
    {
        SessionDataTO.setCurrentView(ViewIdentityEnum.SALESMAN_FORM);
        return null;
    }

    public String goToSalesmanList()
    {
        SessionDataTO.setCurrentView(ViewIdentityEnum.SALESMAN_LIST);
        return null;
    }

    public String goToTextForm()
    {
    	Text txt = new Text();
    	BeanService.putSessionScopeBean(Text.getBeanName(), txt);
        SessionDataTO.setCurrentView(ViewIdentityEnum.TEXT_FORM);
        return null;
    }

    public String goToTextList()
    {
        BeanService.putSessionScopeBean(Invitation.getBeanName(), null);
    	SessionDataTO.setCurrentView(ViewIdentityEnum.TEXT_LIST);
        return null;
    }

    public String goToOrderForm()
    {
        SessionDataTO.setCurrentView(ViewIdentityEnum.ORDER_FORM);
        return null;
    }

    public String goToNewOrderForm()
    {
        Order ordr = new Order();
        CurrentUserTO user = (CurrentUserTO) BeanService.getSessionScopeBean("currentUserTO");
        ordr.setSalesmanID(user.getCurrentSalesman());
        ordr.setResponsible(user.getCurrentSalesman());
        BeanService.putSessionScopeBean(Order.getBeanName(), null);
        BeanService.putSessionScopeBean(Order.getBeanName(), ordr);
        SessionDataTO.setCurrentView(ViewIdentityEnum.ORDER_FORM);
        return null;
    }

    public String goToOrderList()
    {
    	SessionDataTO.setCurrentView(ViewIdentityEnum.ORDER_LIST);
        BeanService.putSessionScopeBean(Order.getBeanName(), null);
        return null;
    }

    public String goToCommentList()
    {
        SessionDataTO.setCurrentView(ViewIdentityEnum.COMMENT_LIST);
        BeanService.putSessionScopeBean(Comment.getBeanName(), null);
        return null;
    }

    public String goToOrderSearchForm()
    {
        SessionDataTO.setCurrentView(ViewIdentityEnum.ORDER_SEARCH_FORM);
        return null;
    }

    public String goToInvitationForm()
    {
        SessionDataTO.setCurrentView(ViewIdentityEnum.INVITATION_FORM);
        return null;
    }

    public String goToAttachmentUpload()
    {
        SessionDataTO.setCurrentView(ViewIdentityEnum.ATTACHMENT_UPLOAD);
        return null;
    }
    
    public String goToPriceParameterList()
    {
        SessionDataTO.setCurrentView(ViewIdentityEnum.PRICE_PARAMETERS);
        return null;
    }
    
    public String goToActivityList()
    {
        SessionDataTO.setCurrentView(ViewIdentityEnum.SALESMAN_ACTIVITY);
        return null;
    }

    public String goToTextListPopup()
    {
        SessionDataTO.setCurrentPopupView(ViewIdentityEnum.TEXT_LIST);
        return "dialog:popup_window";
    }

	public String logout()
    {
        return "logout";
    }
}
